home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Mac Format 1995 June
/
MacFormat 25.iso
/
Shareware City
/
Developers
/
ICProgKit1.0
/
Source
/
Libs
/
ICSubs.c
< prev
next >
Wrap
C/C++ Source or Header
|
1994-11-29
|
642b
|
34 lines
#include "ICAPI.h"
#include "ICKeys.h"
#include "ICSubs.h"
ICError ICGetPrefHandle (ICInstance inst, ConstStr255Param key,
ICAttr *attr, Handle *prefh)
{
ICError err = noErr;
long prefsize = 0;
(*prefh) = 0L;
err = ICGetPref(inst, key, attr, nil, &prefsize);
if (err != noErr) prefsize = 0;
(*prefh) = NewHandle(prefsize);
err = MemError();
if (err == noErr) {
HLock(*prefh);
err = ICGetPref(inst, key, attr, *(*prefh), &prefsize);
if (err == icPrefNotFoundErr) {
attr = 0;
err = noErr;
}
HUnlock(*prefh);
}
if (err != noErr) {
if (*prefh) DisposeHandle(*prefh);
(*prefh) = nil;
}
return(err);
}